package main

import (
	"GoMaestro/internal/conf"
	"GoMaestro/internal/db"
	"GoMaestro/internal/inits"
	jenkins "GoMaestro/internal/jencli"
	"GoMaestro/internal/job"
	"GoMaestro/internal/logger"
	"GoMaestro/internal/web"
	"context"
	"os/signal"
	"syscall"
)

func init() {
	conf.Init()
	logger.Init()
	//cli.Init()
	db.Init()
	jenkins.Init()
	job.Init()
}

func main() {
	ctx, _ := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)

	//oldLevel := logger.SetLevel(conf.Main.Log.Level)
	//if oldLevel == "" {
	//	os.Exit(5)
	//}

	// Ignore errors; 出错自动os.Exit(5)
	web.Run(ctx, inits.R)
}
